#ifndef THINK_THINK_CONSOLE_INPUT_ARGUMENT_H
#define THINK_THINK_CONSOLE_INPUT_ARGUMENT_H

static char* think_console_input_argument =
	"\n"
	"// +----------------------------------------------------------------------\n"
	"// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n"
	"// +----------------------------------------------------------------------\n"
	"// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.\n"
	"// +----------------------------------------------------------------------\n"
	"// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n"
	"// +----------------------------------------------------------------------\n"
	"// | Author: yunwuxin <448901948@qq.com>\n"
	"// +----------------------------------------------------------------------\n"
	"\n"
	"namespace think\\console\\input;\n"
	"\n"
	"class Argument\n"
	"{\n"
	"\n"
	"    const REQUIRED = 1;\n"
	"    const OPTIONAL = 2;\n"
	"    const IS_ARRAY = 4;\n"
	"\n"
	"    private $name;\n"
	"    private $mode;\n"
	"    private $default;\n"
	"    private $description;\n"
	"\n"
	"    /**\n"
	"     * 构造方法\n"
	"     * @param string $name        参数名\n"
	"     * @param int    $mode        参数类型: self::REQUIRED 或者 self::OPTIONAL\n"
	"     * @param string $description 描述\n"
	"     * @param mixed  $default     默认值 (仅 self::OPTIONAL 类型有效)\n"
	"     * @throws \\InvalidArgumentException\n"
	"     */\n"
	"    public function __construct($name, $mode = null, $description = \'\', $default = null)\n"
	"    {\n"
	"        if (null === $mode) {\n"
	"            $mode = self::OPTIONAL;\n"
	"        } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {\n"
	"            throw new \\InvalidArgumentException(sprintf(\'Argument mode \"%s\" is not valid.\', $mode));\n"
	"        }\n"
	"\n"
	"        $this->name        = $name;\n"
	"        $this->mode        = $mode;\n"
	"        $this->description = $description;\n"
	"\n"
	"        $this->setDefault($default);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取参数名\n"
	"     * @return string\n"
	"     */\n"
	"    public function getName()\n"
	"    {\n"
	"        return $this->name;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 是否必须\n"
	"     * @return bool\n"
	"     */\n"
	"    public function isRequired()\n"
	"    {\n"
	"        return self::REQUIRED === (self::REQUIRED & $this->mode);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 该参数是否接受数组\n"
	"     * @return bool\n"
	"     */\n"
	"    public function isArray()\n"
	"    {\n"
	"        return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置默认值\n"
	"     * @param mixed $default 默认值\n"
	"     * @throws \\LogicException\n"
	"     */\n"
	"    public function setDefault($default = null)\n"
	"    {\n"
	"        if (self::REQUIRED === $this->mode && null !== $default) {\n"
	"            throw new \\LogicException(\'Cannot set a default value except for InputArgument::OPTIONAL mode.\');\n"
	"        }\n"
	"\n"
	"        if ($this->isArray()) {\n"
	"            if (null === $default) {\n"
	"                $default = [];\n"
	"            } elseif (!is_array($default)) {\n"
	"                throw new \\LogicException(\'A default value for an array argument must be an array.\');\n"
	"            }\n"
	"        }\n"
	"\n"
	"        $this->default = $default;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取默认值\n"
	"     * @return mixed\n"
	"     */\n"
	"    public function getDefault()\n"
	"    {\n"
	"        return $this->default;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取描述\n"
	"     * @return string\n"
	"     */\n"
	"    public function getDescription()\n"
	"    {\n"
	"        return $this->description;\n"
	"    }\n"
	"}\n"
	"\n"
;
#endif